Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

237
Vistas
Discord.js | I'm trying to check if a role has a specific permission for a mute role

Basically I'm making a ultra customizable discord bot, and you have to specify in the config file the name of the role you want to use when you mute someone. And as a fail-safe in case the role is invalid or misspelled the bot looks himself for a role that has the permission "SEND_MESSAGE" turned off.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Look in the guild's RoleManager for a role that does not have the permission by using .find(). This will return the first role that does not have 'SEND_MESSAGES'

const role = message.guild.roles.cache
   .find(r => !r.permissions.has('SEND_MESSAGES'));

role will return undefined if a role without 'SEND_PERMISSIONS' was not found.

If you want to increase accuracy of finding a muted role given that the name is misspelled check what the name of the role starts with.

// Account for spelling mistakes, given that "mu" in "muted" is correct
const role = message.guild.roles.cache
   .find(r => !r.permissions.has('SEND_MESSAGES') && r.name.toLowerCase().startsWith('mu'));
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda